package com.belarus.kamianiec.photo.photoSite.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.belarus.kamianiec.photo.photoSite.dao.NewsDAO;
import com.belarus.kamianiec.photo.photoSite.domain.News;

@Service
public class NewsServiceImpl implements NewsService {

	private NewsDAO newsDAO;

	@Transactional
	public void addNews(News news) {
		newsDAO.addNews(news);
	}

	@Transactional
	public List<News> listNews() {

		return newsDAO.listNews();
	}

	@Transactional
	public void removeNews(Integer id) {
		newsDAO.removeNews(id);
	}

	public NewsDAO getNewsDAO() {
		return newsDAO;
	}

	@Autowired(required=false)
	public void setNewsDAO(NewsDAO newsDAO) {
		this.newsDAO = newsDAO;
	}
}
